from flask import request,jsonify
import json



#无限极分类
def xtree(data):
    if data:
        tree = {}
        list = []
        #先抓换成字典
        for i in data:
            tree[i['id']] = i
        for j in data: 
            if j['pid'] == 0:
                list.append(j)
            else:
                if 'son' not in tree[j['pid']]:
                    tree[j['pid']]['son'] = []
                tree[j['pid']]['son'].append(j)
        
        return list

#获取数据
def get_data():
    data = request.data
    if data:
        data= json.loads(data)
    else:
        data = request.form
    
    return data

#七牛云
# 需要填写你的 Access Key 和 Secret Key
access_key = 'Z8cIpcbSFgFY7cu2pEROJAztVA2FZysEvW8cb6cT'
secret_key = 'RaYxEfA8-eJNe1ozvoquU17S-SXLS8pX-QayhB-L'








